@echo off

if "%1" == "" goto syntax_error
rem if "%2" == "" goto syntax_error
rem if "%3" == "" goto syntax_error

set TOOL_DBSERVER=%1
set TOOL_DBACCOUNT=qqq
set TOOL_DBPASSWORD=www
set TOOL_DBNAME=ParvisTest

@echo Alter database Parvis....
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% alterTestDB.sql
if errorlevel 1 goto sql_error

@echo Parvis Version
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% ParvisVersion.sql
if errorlevel 1 goto sql_error

@echo Parvis Indexes
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% ParvisIndexes.sql
if errorlevel 1 goto sql_error

@echo Email Templates
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% Data\EmailTemplate.sql
if errorlevel 1 goto sql_error

@echo *************************************************************
@echo *
@echo * Database Parvis removed all views and store procedures.
@echo *
@echo *************************************************************
goto end


:syntax_error
@echo *************************************************************
@echo *
@echo * Syntax error!
@echo * Required parameter is missing.
@echo *
@echo * Usage: AlterDatabase 'DatabaseServerName' 'Account' 'Password'
@echo *
@echo *************************************************************

:sql_error
:end
